﻿
<div class="page-content">
    <table id="dg" class="easyui-datagrid" title="申请管理" style="width:100%;height:auto" data-options="
							rownumbers:true,
							checkOnSelect:false,
                            url:'/Customer/AllApply',
							pagination:true,
							pageSize:10,
							method:'get',
							selectOnCheck:false,
							fitColumns:true,
							singleSelect:true,
							">
        <thead>
            <tr>
                <th data-options="field:'act',formatter:editbtn">操作</th>
                <th data-options="field:'C_Name',width:80">用户名</th>
                <th data-options="field:'C_Address',width:100">送货地址</th>
                <th data-options="field:'T_Name',width:80">申请人</th>
                <th data-options="field:'T_Address',width:80">申请人</th>
                <th data-options="field:'T_Phone',width:80,align:'right'">联系电话</th>
            </tr>

        </thead>
    </table>
   
    <script type="text/javascript">
        $(function () {
            $(".nav-list li").eq(5).addClass("active");

        });
        function editbtn(value, row, index) {

            var _btn = '<button class="btn btn-success btn-xs" style="margin:3px;" onclick="aggree(' + row.o_id + ',event)">通过</button>';
            _btn += '<button class="btn btn-inverse btn-xs" style="margin:3px;" onclick="decline(' + row.o_id + ',event)">拒绝</button>';
              return _btn;
        }

        function aggree(id,event) {
            event.stopPropagation();
            $.ajax({
                type: 'get',
                url: '/Customer/Reply',
                async: true,
                data: { 'id': id, 'val': 0 },
                success: function () {
                    $("#dg").datagrid("reload");
                }
            });

        }   

        function decline(id, event) {
            $.ajax({
                type: 'get',
                url: '/Customer/Reply',
                async: true,
                data: { 'id': id, 'val': 1 },
                success: function () {
                    $("#dg").datagrid("reload");
                }
            });

        }
    </script>
</div>